package String类编程题;

import java.util.Scanner;

public class Question6 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter student's information in a line:(eg. “   张三   ,     20    ,男”");
        String information = in.nextLine().replace(" ","");
        String[] informationValues = information.split(",");
        Student student = new Student(informationValues[0],Integer.valueOf(informationValues[1]),
                informationValues[2].charAt(0));
        System.out.println(student);
    }
}

class Student{
    private String name;
    private Integer age;
    private Character gender;

    public Student(String name, Integer age, Character gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender=" + gender +
                '}';
    }
}
